Skip to content

feat(hub): desktop notifications for what needs attention (ADR-0045) - #161

Merged
7schmiede merged 3 commits into
mainfrom
feat/notifications
Oct 21, 2026
Merged

7schmiede merged 3 commits into
mainfrom
feat/notifications

Conversation

@7schmiede

Copy link
Copy Markdown
Member

Implements #156. ADR-0045 is Proposed: per ADR-0001 it needs the owner's acceptance before this merges (then a docs(adr): ADR-0045 accepted commit, as for ADR-0044).

What

The hub follows every running stack and each of its started lanes (local, or on a node through the stack's daemon) and notifies the desktop:

Kind Default
build_failed: a candidate's build failed, or a service's build at its start on
held: a candidate is held and waits for promote on
service_failed: a service exited by itself, or failed to start on
lane_failed: a lane's start or move on a node failed on
main_ports: a lane took or gave back the main ports off
live: a candidate went live off
  • Only changes notify. The state a stream starts with is the baseline. The same kind for the same service of the same stack or lane notifies once in 5 minutes, so a crash loop is one notification.
  • Windows: WinRT toast under the AppUserModelID devstack.hub, registered in HKCU\Software\Classes\AppUserModelId. No Start-menu shortcut and no admin rights are needed (measured, see the ADR). self uninstall removes it.
  • Linux: org.freedesktop.Notifications over the session bus via zbus, which is pure Rust, so the musl binary stays static-pie linked. Without a session bus nothing shows and the hub says why.
  • Click → dashboard on that stack, lane and service.
    • Windows: the toast launches devstack://open?stack=…&lane=…&service=…, which pairs the browser like devstack ui does.
    • Linux: the hub hears ActionInvoked itself and opens the dashboard.
    • /auth takes next (a dashboard route only), and a browser that is already paired keeps its session.
  • Settings per machine (notify.json in the hub's state): each kind on or off, and a mute per stack or lane.
    • API: GET/PUT /hub/notify, POST /hub/notify/test.
    • Dashboard: a bell in the top bar.
    • CLI: devstack hub notify [on|off <kind>…|all|test].
    • DEVSTACK_NO_NOTIFY=1 turns them off; the hub test harness sets it.
  • ADR-0018 point 2 is amended (notifications without the tray). SECURITY.md documents the new devstack://open link.

Fixed along the way

  • --browser / DEVSTACK_BROWSER on Windows: cmd /c start cut an address at &. The address is now passed in quotes, and web_url refuses ".
  • Dashboard: a lane chosen before the hub said the stack runs (a link, or the first visit) streamed without its lane list. watch(running) now loads the lanes.

Tested

  • Unit tests:
    • notify::rules: baseline, failed or held candidates, crash vs. stop, lanes.
    • Folding, settings, mute and validation.
    • /auth next, the devstack://open parser, toast XML escaping.
  • tests/hub.rs, new tests:
    • Settings API.
    • /auth?next= with and without an existing session.
    • A stack whose service keeps exiting gives exactly one service_failed notice, with no dashboard open.
  • Manually on Windows 11:
    • The test toast and a real crash toast appear in the notification history.
    • Their launch is devstack://open?stack=…&service=api.
    • devstack open-url with that link → a paired URL → 303 to /#/s/<id>/services/api?lane=feat-x.
  • Linux (Docker, rust:latest):
    • Clippy is clean and the hub tests pass.
    • Against a python-dbusmock notification daemon, Notify arrives with the right arguments, and a simulated ActionInvoked makes the hub open the dashboard.
    • The musl build is static-pie linked. Without a desktop session: "no desktop session (no D-Bus session bus …)".
  • Dashboard (mock, headless Edge): the bell popover, per-lane mute, and the ?lane= deep link on a first visit.
  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace, npm run typecheck, npm test.

Notes

Closes #156

🤖 Generated with Claude Code

The hub follows every running stack and each of its started lanes (on a
node too, through the stack's daemon) and tells the desktop when a build
failed, a candidate is held for promote, a service exited by itself or
failed to start, or a lane's start or move on a node failed; on request
also when a lane took the main ports or a candidate went live. Only
changes notify, and the same kind for the same service once in five
minutes, so a crash loop is one notification.

Windows: a WinRT toast under an AppUserModelID the hub registers in HKCU
(no shortcut, no admin rights). Linux: org.freedesktop.Notifications over
the session bus with zbus, so the binary stays static; without a session
bus nothing shows and the hub says why. A click opens the dashboard on
the stack, lane and service: a `devstack://open` link on Windows, the hub
itself on Linux; `/auth` takes `next` (a dashboard route only) and keeps
the session of a browser that is paired already.

Settings per machine in the hub (notify.json): each kind on or off, a
mute per stack or lane. GET/PUT /hub/notify, POST /hub/notify/test, the
bell in the dashboard's top bar, `devstack hub notify`.
DEVSTACK_NO_NOTIFY switches them off.

Also fixed on the way: `--browser`/DEVSTACK_BROWSER on Windows cut an
address at `&` (cmd); the dashboard opened on a lane before it knew the
stack runs showed the lane without its list of lanes.

Refs #156

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7schmiede and others added 2 commits October 21, 2026 14:11
# Conflicts:
#	CHANGELOG.md
#	docs/adr/README.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@7schmiede
7schmiede merged commit 65c041b into main Oct 21, 2026
@7schmiede 7schmiede mentioned this pull request Oct 21, 2026
@7schmiede
7schmiede deleted the feat/notifications branch October 23, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop notifications for build failures, held candidates and more, per kind of event

1 participant